/*
 * @(#)Model.java
 *
 * @author <a href="gubarevs@apollo.lv">Denis Gubarev</a>
 */

package com.gshappcore.model;

import com.google.gwt.user.client.rpc.IsSerializable;


import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * @author <a href="gubarevs@apollo.lv">Denis Gubarev</a>
 */
public class Model implements IsSerializable {

    private HashMap attributes = new HashMap();

    public final void set(String id, Object value) {
        attributes.put(id, value);
    }

    public final Object get(String id) {
        return attributes.get(id);
    }

    public final String getString(String id) {
        return (String) attributes.get(id);
    }

    public final Long getLong(String id) {
        return (Long) attributes.get(id);
    }

    public final Integer getInteger(String id) {
        return (Integer) attributes.get(id);
    }

    public final void setString(String id, String value) {
        set(id, value);
    }

    public final Model getModel(String id) {
        return (Model) attributes.get(id);
    }

    public List getAvailableAttributes() {
        return new ArrayList(attributes.keySet());
    }

    public final List<? extends Model> getModelList(String id) {
        return (List<? extends Model>) attributes.get(id);
    }
}
